home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000016_icon-group-sender _Tue Jan 16 10:08:39 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 16 Jan 1996 12:30:29 MST
  2. Message-Id: <m0tc6vz-000PYzC@ns1.computek.net>
  3. Date: Tue, 16 Jan 96 12:10 IST
  4. Mime-Version: 1.0
  5. Content-Type: text/plain
  6. Content-Transfer-Encoding: 7bit
  7. From: gep2@computek.net
  8. Subject: Initializing tables
  9. To: icon-group@cs.arizona.edu
  10. X-Mailer: SPRY Mail Version: 04.00.06.17
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: O
  13.  
  14. >   aTable := table()
  15.    every entry := ![["bob",2],["sue",5],["fred",12],["mary",9]] do
  16.       aTable[entry[1]] := entry[2]
  17.  
  18. For SNOBOL4+/SPITBOL, Gimpel proposes something like the following:
  19.  
  20.     dd = "0123456789"    ;* define decimal digits
  21.     atable = table()
  22.     tinit = "bob2sue5fred12mary9"
  23. initl1    tinit fence break(dd) . name span(dd) . num =
  24. +      ?(atable[name] = num)            :s(initl1)
  25.  
  26. If you have many large tables that you need to initialize this way, and in a 
  27. program you intend to use many times, it can be helpful to go ahead and save the 
  28. executable/intepretable to disk AFTER this preliminary execution stage is 
  29. finished.
  30.  
  31. Gordon Peterson
  32. http://www.computek.net/public/gep2/
  33.  
  34.